package com.survivor.menu;

import javax.microedition.khronos.opengles.GL10;

import com.survivor.activity.CoordHelper;

import android.content.Context;
import android.graphics.Bitmap.Config;

public class AllContent {
	
	MenuMoving moving;
	MenuText text;
	MenuButton button;
	
	
	
	public static final int MAIN_VIWE = 0;
	public static final int HELP_VIEW = 1;
	public static final int RANDLIST_VIEW = 2;
	public static final int SETTING_VIEW = 3;
	
	static int curView = MAIN_VIWE;
	
	CoordHelper ch;
	
	public AllContent(Context context)
	{
		ch = new CoordHelper(context);
		moving = new MenuMoving(context, ch);
		text = new MenuText(context, ch);
		button = new MenuButton(context, ch);
	}
	
	
	public void doDraw(GL10 gl)
	{
		moving.setFloatBuffer(gl);
		moving.drawBackground(gl);
		
		switch (curView) {
		case MAIN_VIWE:
			drawMainView(gl);
			break;
		case HELP_VIEW:
			drawHelpView(gl);
			break;
		case RANDLIST_VIEW:
			drawRankListView(gl);
			break;
		case SETTING_VIEW:
			drawSettingView(gl);
			break;
		}
	}
	
	private void drawMainView(GL10 gl)
	{
		moving.drawTitleBold(gl);
		moving.drawBall(gl);
		text.drawSmallTitle(gl);
		text.drawBigTitle(gl);
		text.drawButtom(gl);
		button.drawPlayAndExit(gl);
		button.drawHelpAndRank(gl);
	}
	
	private void drawHelpView(GL10 gl)
	{
		text.drawBigTitle(gl);
		button.drawReturn(gl);
		text.drawHelpBg(gl);
		text.drawHelpInfo(gl);
	}
	
	private void drawRankListView(GL10 gl)
	{
		text.drawHelpBg(gl);
		text.drawBigTitle(gl);
		button.drawReturn(gl);
	}
	
	private void drawSettingView(GL10 gl)
	{
		moving.drawTitleBold(gl);
		text.drawSmallTitle(gl);
		text.drawBigTitle(gl);
		button.drawSetting(gl);
	}
	
	
	public void loadTextures(GL10 gl)
	{
		moving.loadTextures(gl);
		text.loadTextures(gl);
		button.loadTextures(gl);
	}

}
